/**
 * Project hdmap
 * @author shengjialiang
 * @version v1.0
 */


#ifndef _OBJECTVECTOR_H
#define _OBJECTVECTOR_H

#include "OpenThreads/Mutex"
#include "map_common/Object.h"

namespace Common
{
	class MAP_COMMON_EXPORTS CObjectVector
        : public Common::CObject
    {
    public:
        CObjectVector();

        virtual ~CObjectVector();

        bool add(Common::CObject* in_pRefObject);

        int size();

        Common::CObject* get(const int& in_index);

		Common::CObject* get(const std::string& in_id);

        bool get(std::vector<Common::CObject*>& inout_objects);
        
        bool remove(Common::CObject* in_pObject);

        Common::CObject* remove(const int& in_index);

        bool removeAndDestroy(const int& in_index);

        bool removeAll();

        bool removeAllAndDestroy();


    private:
        void lock();

        void unlock();

    private:
        std::vector<Common::CObject*> mObjects;
        OpenThreads::Mutex mMutex;
    };
}

#endif //_OBJECTVECTOR_H